import Common from "../src/utils/Common";

// alert弹窗接口类型
export interface alertInterface {
    theme?: string,
    title?: string,
    content: string,
    btn: string,
    success: Function,
    close?: Function
}
// St类的接口类型
export interface StInterface {
    theme: string,
    app: string,
    signUrl: string,
}
// Open接口类型
export interface OpenInterface {
    check?: Boolean,
    type?: String,
    data?: any,
    success?: Function,
    error?: Function,
    gotoCreate?: Function,
    editFun?: Function,
    setOtherFun?: Function,
    close?: Function
}
// Bone类的接口类型
export interface BoneInterface {
    width?: string;
    height?: string;
}

// 基础组件Button接口
export interface Button {
    width: number,
    height: number,
    background?: string,
    color?: string,
    text: string,
    clickHandle?: Function
}
// 基础组件Radio接口
export interface Radio {
    name: string,
    text: string,
    checked?: boolean
    id: string
}
// 基础组件CheckBox接口
export interface CheckBox {
    value: string,
    checked?: boolean,
    id: string,
    text: string,
    name: string
}
// CheckBox数据接口
export interface CheckBoxData {
    list: Array<CheckBox>
}
// 基础组件Label 接口
export interface Label {
    htmlFor: string,
    text: string
}
// 基础组件Input接口
export interface Input {
    id?: string,
    name: string,
    type: string,
    value?: string,
    checked?: boolean
}
// 基础组件 Select接口
export interface Select {
    name: string,
    list: Array<{
        id: string,
        name: string
    }>,
    id: string
}
// 基础组件Option接口
export interface Option {
    id: string,
    name: string
}
// info元数据接口
export interface itemInterface {
    title: string,
    value: string
}
// info 列表接口
export type InfoList = Array<itemInterface>;
// 版本接口
export interface Version {
    id: number,
    name: string,
    checked: boolean
}
//以版本为元数据构成的数据接口
export type VerisonListInterface = Array<Version>;

/*
 * @Author: liu wang wang
 * @Date: 2020-07-10 16:21:41
 * @LastEditTime: 2020-07-14 11:27:14
 * @LastEditors: liu wang wang
 * @Description: Api请求类的类型文件
 * @FilePath: \st-sdk-js\src\api\types.ts
 */
export type Method =
    | 'get'
    | 'GET'
    | 'delete'
    | 'DELETE'
    | 'head'
    | 'HEAD'
    | 'options'
    | 'OPTIONS'
    | 'post'
    | 'POST'
    | 'put'
    | 'PUT'
    | 'patch'
    | 'PATCH';

export interface RequestConfig {
    url: string
    method?: Method
    data?: any
    params?: any,
    headers?: any,
    responseType?: XMLHttpRequestResponseType,
    success?: Function,
    error?: Function
}
export interface KaisaAjaxResponse {
    data: any
    status: number
    statusText: string
    headers: any
    config: RequestConfig
    request: any
}

export interface requestOptions {
    data?: any
    params?: any,
    success?: Function,
    error?: Function
}

export interface processAjaxInterface extends requestOptions{
    url: string
}
export interface defaultInitInterface extends OpenInterface{
    theme: string,
    zoneID?: number,
    versionID?: number
}
export interface infoInitInterface extends OpenInterface {
    theme: string,
    app: string,
    edit: Function,
    setOther: Function,
    zoneID?: number,
    versionID?: number
}

export interface chooseInterface {
    theme: string,
    success: Function,
    gotoCreate?: Function
}

export interface editInterface extends OpenInterface{
    theme: string,
    zoneID?: number,
    versionID?: number
}

export interface copyInterface{
    oldZoneID:number,
    newZoneID: number,
    success: Function
}